#include "../header.h"

int main(int argc, char const *argv[])
{
    char buf[128] = "";
    printf("第一次输入数据\n");
    read(STDIN_FILENO, buf, sizeof(buf));
    //默认属性
    int oldflg = fcntl(STDIN_FILENO, F_GETFL);
    int newflg = oldflg | O_NONBLOCK;
    //成功返回0 失败返回-1
    if (!fcntl(STDIN_FILENO, F_SETFL, newflg))
        printf("非阻塞属性修改成功\n");
    else 
        printf("非阻塞属性修改失败\n");
    //非阻塞
    printf("第二次输入数据\n");
    bzero(buf, sizeof(buf));
    read(STDIN_FILENO, buf, sizeof(buf));
    
    return 0;
}
